summaryrefslogtreecommitdiff
path: root/src/pages/api/auth/[...nextauth].js
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages/api/auth/[...nextauth].js')
-rw-r--r--src/pages/api/auth/[...nextauth].js13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/pages/api/auth/[...nextauth].js b/src/pages/api/auth/[...nextauth].js
index 6cc8a101..b11ed097 100644
--- a/src/pages/api/auth/[...nextauth].js
+++ b/src/pages/api/auth/[...nextauth].js
@@ -1,3 +1,4 @@
+import odooApi from '@/core/api/odooApi'
import NextAuth from 'next-auth/next'
import GoogleProvider from 'next-auth/providers/google'
@@ -10,20 +11,20 @@ export default NextAuth({
],
callbacks: {
async jwt({ token, account }) {
- // Persist the OAuth access_token to the token right after signin
if (account) {
token.accessToken = account.access_token
}
return token
},
async session({ session, token, user }) {
- // Send properties to the client, like an access_token from a provider.
session.accessToken = token.accessToken
+ const params = {
+ access_token: session.accessToken
+ }
+ const data = await odooApi('POST', '/api/v1/user/validate-sso', params)
+ session.odooUser = data.user
return session
}
},
- secret:process.env.JWT_SECRET
- // pages:{
- // signIn: '/login',
- // }
+ secret: process.env.JWT_SECRET
})